package com.diy.sigmund.diyorder.test.controller;

import com.diy.sigmund.diycommon.entity.ResultMsg;
import com.diy.sigmund.diycommon.test.entity.LocalDateTimeDTO;
import com.diy.sigmund.diycommon.test.entity.LocalDateTimeVO;
import com.diy.sigmund.diycommon.util.BeanCopyUtil;
import com.diy.sigmund.diycommon.util.json.JacksonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ylm-sigmund
 * @since 2020/9/14 13:11
 */

@RestController
@RequestMapping("localDateTime")
public class LocalDateTimeController {

    private static final Logger log = LoggerFactory.getLogger(LocalDateTimeController.class);

    @PostMapping("test1")
    public ResultMsg test1(@RequestBody LocalDateTimeDTO localDateTimeDTO) {
        log.info("localDateTimeDTO:{}", JacksonUtil.toJson(localDateTimeDTO));
        LocalDateTimeVO localDateTimeVO = new LocalDateTimeVO();
        BeanCopyUtil.copy(localDateTimeDTO, localDateTimeVO);
        ResultMsg success = ResultMsg.success(localDateTimeVO);
        log.info("success:{}", JacksonUtil.toJson(success));
        return success;
    }
}
